package com.atguigu.tingshu.user.mapper;

import com.atguigu.tingshu.model.user.UserInfo;
import com.atguigu.tingshu.model.user.UserSubscribe;
import com.atguigu.tingshu.vo.user.UserSubscribeVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserInfoMapper extends BaseMapper<UserInfo> {

    @Update("update user_info set is_vip = 0 where is_vip = 1 and vip_expire_time < now() and is_deleted = 0")
    void updateIsVip();

    IPage<UserSubscribeVo> selectUserSubscribePage(Page<UserSubscribeVo> subscribeVoPage,@Param("vo") UserSubscribe userSubscribe);
}
